//
//  discountCouponTableViewCell.m
//  lmq
//
//  Created by 千翼网络科技 on 2017/3/14.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "discountCouponTableViewCell.h"
#import "configddd.h"
#import <Masonry/Masonry.h>

@implementation discountCouponTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:@"identifier"]) {
        
        [self initView];
    }
    return self;
}

- (void)initView{
    
    _bgView = [[UIView alloc]initWithFrame:CGRectMake(screenScale(20), screenScale(20), scrWidth() - screenScale(40), screenScale(170))];
    _bgView.backgroundColor = [UIColor whiteColor];
    [self addSubview:_bgView];
    
//    边框
    
    _thread1 = [[UIView alloc]initWithFrame:CGRectMake(0, screenScale(1), scrWidth() - screenScale(40), screenScale(1))];
    _thread1.backgroundColor = getColor(@"cccccc");
    [_bgView addSubview:_thread1];
    
    _thread2 = [[UIView alloc]initWithFrame:CGRectMake(screenScale(1), 0, screenScale(1), screenScale(170))];
    _thread2.backgroundColor = getColor(@"cccccc");
    [_bgView addSubview:_thread2];
    
    _thread3 = [[UIView alloc]initWithFrame:CGRectMake(0, screenScale(120), scrWidth() - screenScale(40), screenScale(1))];
    _thread3.backgroundColor = getColor(@"f5f5f5");
    [_bgView addSubview:_thread3];
    
    _thread4 = [[UIView alloc]initWithFrame:CGRectMake(0, screenScale(169), scrWidth() - screenScale(40), screenScale(1))];
    _thread4.backgroundColor = getColor(@"cccccc");
    [_bgView addSubview:_thread4];
    
    _thread5 = [[UIView alloc]initWithFrame:CGRectMake(scrWidth() - screenScale(40), 0, screenScale(1), screenScale(170))];
    _thread5.backgroundColor = getColor(@"cccccc");
    [_bgView addSubview:_thread5];
    
//    优惠金额
    
    _moneyLable = [[UILabel alloc]initWithFrame:CGRectMake(screenScale(40), screenScale(65), screenScale(24), screenScale(24))];
    _moneyLable.text = @"¥";
    _moneyLable.font = get4sFont(12);
    [_bgView addSubview:_moneyLable];
    
    _use_vouchersLable = [[UILabel alloc]initWithFrame:CGRectMake(screenScale(62), screenScale(47), screenScale(100), screenScale(45))];
    _use_vouchersLable.textColor = getColor(@"000000");
    _use_vouchersLable.text = @"400";
    _use_vouchersLable.font = get4sFont(21);
    [_bgView addSubview:_use_vouchersLable];
    
//    满足条件
    
    _all_vouchersLable = [[UILabel alloc]initWithFrame:CGRectMake(screenScale(310), screenScale(35), screenScale(260), screenScale(30))];
    _all_vouchersLable.text = @"满800可用";
    _all_vouchersLable.textAlignment = NSTextAlignmentRight;
    _all_vouchersLable.font = get4sFont(14);
    [_bgView addSubview:_all_vouchersLable];
    
//    日期
    
    _endDateLable = [[UILabel alloc]init];
    _endDateLable.text = @"2017.01.02";
    _endDateLable.font = get4sFont(12);
    _endDateLable.textAlignment = NSTextAlignmentRight;
    [_bgView addSubview:_endDateLable];
    [_endDateLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).with.offset(screenScale(95));
        make.right.mas_equalTo(_bgView).with.offset(screenScale(-30));
        
        make.height.mas_equalTo(screenScale(25));
    }];
    
    _dateLable = [[UILabel alloc]init];
    _dateLable.text = @"-";
    _dateLable.font = get4sFont(12);
    _dateLable.textAlignment = NSTextAlignmentCenter;
    [_bgView addSubview:_dateLable];
    [_dateLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_endDateLable).with.offset(0);
        make.left.mas_equalTo(_endDateLable).with.offset(screenScale(-25));
        make.width.mas_equalTo(screenScale(25));
        make.height.mas_equalTo(screenScale(25));
    }];
    
    _startDateLable = [[UILabel alloc]init];
    _startDateLable.text = @"2017.01.01";
    _startDateLable.font = get4sFont(12);
    _startDateLable.textAlignment = NSTextAlignmentRight;
    [_bgView addSubview:_startDateLable];
    [_startDateLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_dateLable).with.offset(0);
        make.right.mas_equalTo(_dateLable).with.offset(screenScale(-25));
        
        make.height.mas_equalTo(screenScale(25));
    }];
    
//    底部text
    
    _textLable = [[UILabel alloc]initWithFrame:CGRectMake(screenScale(38), screenScale(134), screenScale(520), screenScale(25))];
    _textLable.text = @"全场通用 满减专场和人专场不参与";
    _textLable.textColor = getColor(@"686868");
    _textLable.font = get4sFont(12);
    [_bgView addSubview:_textLable];
}

@end
